package com.sixteengroup.personnelms.config;

import com.sixteengroup.personnelms.util.TokenInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 *
 * @Date 2021-06-08 17:23
 * @function 注册拦截器
 */
@Configuration
public class InterceptorConfig  implements WebMvcConfigurer {

    @Autowired
    TokenInterceptor jwtInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(jwtInterceptor)
                .addPathPatterns("/**")
                .excludePathPatterns("/user/login")
                .excludePathPatterns("/user/reg")
                .excludePathPatterns("/user/**")
                .excludePathPatterns("/comInfoMeg/getComInfo")
                .excludePathPatterns("/articleMeg/getArticle")
                .excludePathPatterns("/articleMeg/getArticleInfo")
                .excludePathPatterns("/recruitMeg/getRecruit")
                .excludePathPatterns("/resources/**");

    }

}
